package xib.parserTools.interfaces;

import java.util.ArrayList;
import xib.utils.EncodedString;
import xib.utils.XibDataException;

/**
 * This interface defined all the functions needed to save properly all the
 * information about the Header from the source.
 * @author xavierds
 */
public interface IHeaderData {


    /**
     * Returns the default language of this header. The default language is
     * the language set by default in the header.
     * @return A String with the default language of the Header.
     * @throws XibDataException If the default header wasn't initialized
     * properly.
     */
    String getDefaultLanguage();

    /**
     * Returns the value for the original language of this header. If not
     * defined it returns the empty String.
     * @return A String with the original language of the header.
     */
    String getOriginalLanguage();

    /**
     * Returns a list with all avalaibles languages of this header. The list
     * can not be empty and contains at least the default language.
     * @return A list of String with the availables languages of the header.
     * @throws XibDataException If no languages weren't initialized properly.
     */
    ArrayList<String> getAvailablesLanguages();

    /**
     * Returns the title of this header. It returns a list of EncodedString with
     * the specific title for every language available in this header. The list
     * can not be empty.
     * @return An array with all the titles from the header.
     * @throws XibDataException If no titles weren't initialized properly.
     */
     ArrayList<EncodedString> getTitles();

    /**
     * Returns a list of authors from this header. Each author has a list of 
     * EncodedString with his name in all availables languages. The list can not
     * be empty.
     * @return an array with all the authors from the file
     * @throws XibDataException If no authors where initialized properly.
     */
    ArrayList<ArrayList<EncodedString>> getAuthors();

    /**
     * Returns the default Page Height of this header. The value must be greater
     * than 0.
     * @return an integer with the default height.
     * @throws XibDataException If the height wasn't initialized properly.
     */
    int getDefaultPageHeight();

    /**
     * Returns the default Page Width of this header. The value must be greater
     * than 0.
     * @return an integer with the default width.
     * @throws XibDataException If the width wasn't initialized properly.
     */
    int getDefaultPageWidth();

    /**
     * Add a new language to this header. The given language can not be null or
     * an empty String. Additionally the given language can not be already defined.
     * @param language A String with the language to add to the header.
     * @throws XibDataException If the given language is already defined or if
     * is null or an empty String.
     */
    void addLanguage(String language);

    
    /**
     * Add an author to this header information. The parameters are a list with
     * the differents names of the same author in the differents availables
     * languages and the other one is the list of languages. The given list
     * parameters can not be null or off differents size.
     * @param A list with the names of the author in the differents languages.
     * @param A list of languages.
     * @throws XibDataException If one of the given list is empty or the two list
     * do not have the same size.
     */
    void addAuthor(ArrayList<String> names, ArrayList<String> languages);

    /**
     * Add a title name to this header in a specific language. The given title
     * or language can not be already defined or the empty String.
     * @param title A String with the specific title for the header.
     * @param language A String with the specific language for the header.
     * @throws XibDataException If the language is already defined or one of the
     * given parameters is not initialized properly.
     */
    void addTitle(String title, String language);

    /**
     * Sets the default language for this header. The given language can not be
     * an empty String.
     * @param language A String with the default language of the header.
     * @throws XibDataException If the given language is not defined properly.
     */
    void setDefaultLanguage(String language);

    /**
     * Sets the original language for this header. This set the original language,
     * it doesn't have to be present in the data. 
     * @param originalLanguage
     * @throws XibDataException If the given language is not defined properly.
     */
    void setOriginalLanguage(String originalLanguage);
    
    /**
     * Sets the width and height of this IHeaderData from the given values.
     * The width and height can not be less than 1.
     * @param width
     * @param height
     * @throws XibDataException If the width or height is less than 1.
     */
    void setDefaultPageHeightAndWidth(int width, int height);

    /**
     * Returns true if the IHeaderData is properly initialized. It throws a
     * XibDataException if some data has not been initialized properly.
     * @return A boolean
     * @throws XibDataException if the languages, titles or authors weren't
     * initialized properly.
     */
    boolean validate();

}
